function X = labcolor_feas(img)
%LABCOLOR_FEAS generating LAB-color feature vectors from an image
%
%   X = LABCOLOR_FEAS(img);
%

%% verify inputs

if ~(isnumeric(img) && ndims(img) == 3 && size(img, 3) == 3)
    error('lab_colorfeas:invalidarg', ...
        'img should be a RGB-color image with three channels.');
end


%% main

if ~isa(img, 'double')
    img = im2double(img);
end

r = img(:,:,1);
g = img(:,:,2);
b = img(:,:,3);

[L, A, B] = rgb_to_lab(r, g, b);

n = numel(L);
L = reshape(L, 1, n);
A = reshape(A, 1, n);
B = reshape(B, 1, n);

X = [L; A; B];


